<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简化对象写法</title>
</head>
<body>
    <script>
        let name = '外星人';
        let price = 5500;
        //对象的简化写法
        let obj = {
            //1. 直接将变量放置到对象结构中
            name,
            price,
            //2. 对象方法可以不写 冒号与 function 
            run(){
                console.log('运行程序')
            },
            playGame(){
                console.log('玩游戏');
            }
        };

        console.log(obj);


    </script>
</body>
</html>